﻿<UserControl x:Class="GBlason.Control.Aggregate.CustomGUI"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Aggregate="clr-namespace:GBlason.Control.Aggregate"
             xmlns:ViewModel="clr-namespace:GBlason.ViewModel" mc:Ignorable="d" 
             xmlns:TemplateSelector="clr-namespace:GBlason.Common.TemplateSelector"
             xmlns:General="clr-namespace:GBlason.ViewModel.General" d:DesignHeight="600" d:DesignWidth="800"
             Background="Transparent">
    
    <UserControl.Resources>
        <DataTemplate x:Key="TabItemTemplate" DataType="{x:Type General:GbsFileViewModel}">
            <TextBlock Text="{Binding Path=FileName}"/>
        </DataTemplate>
        <TemplateSelector:TabTemplateSelector x:Key="TabTemplateSelector"/>
    </UserControl.Resources>
    
  <Grid x:Name="CustomGUIGrid" Background="Transparent">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*" MinWidth="120" MaxWidth="300"/>
            <ColumnDefinition Width="3px"/>
            <ColumnDefinition Width="8*"/>
        </Grid.ColumnDefinitions>
        <Grid x:Name="PropertiesAndTreeGrid" Grid.RowSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="3px"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="3px"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Aggregate:Properties Grid.Row="0" Margin="2" Background="Transparent"
                                  DataContext="{Binding Source={x:Static General:GlobalApplicationViewModel.GetApplicationViewModel}, Path=CurrentlyDisplayedFile.CurrentlySelectedComponent}"/>
            <GridSplitter Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Height="3" Name="propertiesSplitter"
                          Style="{StaticResource GridSplitterStyle}"/>
            <Aggregate:TreeView Grid.Row="2" Margin="2" Background="Transparent"/>
            <GridSplitter Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Stretch" Height="3" Name="treeviewSplitter"
                          Style="{StaticResource GridSplitterStyle}"/>
            <Aggregate:ActionHistory Grid.Row="4" Margin="2" Background="Transparent"/>
        </Grid>
        <GridSplitter Grid.Column="1" HorizontalAlignment="Center" Name="mainSplitter" VerticalAlignment="Stretch" Width="3" Grid.RowSpan="2"
                      Style="{StaticResource GridSplitterStyle}"/>
        <TabControl Grid.Column="2"
                    Name="MultiDocumentTabContent"
                    VerticalAlignment="Stretch"
                    HorizontalAlignment="Stretch"
                    Margin="2"
                    Background="Transparent"
                    ItemsSource="{Binding Source={x:Static General:GlobalApplicationViewModel.GetApplicationViewModel}, Path=OpenedFiles}"
                    ContentTemplateSelector="{StaticResource TabTemplateSelector}"
                    ItemTemplate="{StaticResource ResourceKey=TabItemTemplate}"
                    SelectedItem="{Binding Source={x:Static General:GlobalApplicationViewModel.GetApplicationViewModel}, Path=CurrentlyDisplayedFile}" Grid.RowSpan="2">
        </TabControl>
    </Grid>
</UserControl>
